package com.cqc.manage.service.Imp.business;


import cn.hutool.core.date.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.swing.plaf.PanelUI;

@EnableScheduling
@Component
public class CleanCache {

    private Logger LOG = LoggerFactory.getLogger(CleanCache.class);

    @Autowired
    private BusinessEchartService businessEchartService;

    /**
     * 清空缓存
     * @param str
     */
    @CacheEvict(cacheNames = "echart-main",key = "#str",allEntries=true )
    public void cleanCacheFuncation(String str) {
        LOG.info("清空缓存"+str);
    }


//    @Scheduled(cron = "0 */2 * * * ?")
//    public void cleanCache(){
//        String today = DateUtil.today();
//        cleanCacheFuncation(today);
//    }


//    @Scheduled(cron = "0 */5 * * * ?")
//    public void generateCache(){
//        String today = DateUtil.today();
//        businessEchartService.getMainEchart(today);
//    }


}
